<?php
/**
 * Created by PhpStorm.
 * User: wudiying
 * Date: 2019/2/10
 * Time: 下午10:44
 */

namespace IMooc\Databases;

use IMooc\IDatabase;

class PDO implements IDatabase
{
    protected $conn;

    function connect($host, $user, $password, $dbname)
    {
        $conn = new \PDO("mysql:host=$host;dbname=$dbname",$user,$password);
        $this->conn = $conn;
    }

    function query($query)
    {
        return $this->conn->query($query);
    }

    function close()
    {
        unset($this->conn);
    }
}